//
//  UIView+Frame.swift
//  Swift_missScarlett
//
//  Created by xmg on 16/8/17.
//  Copyright © 2016年 wlis. All rights reserved.
//

import Foundation
import UIKit


internal extension UIView{

    // MARK: - center的x和y
    var centerX : CGFloat{
        get{
            return self.center.x;
        }
        set{
            var center = self.center
            center.x = newValue
            self.center = center
        }
    }
    var centerY : CGFloat{
        get{
            return self.center.y;
        }
        set{
            var center = self.center;
            center.y = newValue
            self.center = center
        }
    }
    // MARK: - 设置x,y,width,height
    var x : CGFloat{
        get{
            return self.frame.origin.x;
        }
        set{
            var frame = self.frame;
            frame.origin.x = newValue
            self.frame = frame
        }
    }
    var y : CGFloat {
        get{
            return self.frame.origin.y;
        }
        set{
            var frame = self.frame;
            frame.origin.y = newValue
            self.frame = frame
        }
    }
    
    var width : CGFloat{
        get{
            return self.frame.size.width;
        }
        set{
            var frame = self.frame;
            frame.size.width = newValue
            self.frame = frame
        }
    }
    var height : CGFloat{
        get{
            return self.frame.size.height;
        }
        set{
            var frame = self.frame;
            frame.size.height = newValue
            self.frame = frame
        }
    }
}